<template>
  <div id="app">
    <div id="nav">
      <router-link v-bind:to="{ name: 'home' }">Home</router-link> |
      <router-link v-bind:to="{ name: 'about' }">About</router-link>
    </div>
    <transition-group :name="routerTransition">
      <router-view key="default" />
      <router-view key="email" name="email" />
      <router-view key="tel" name="tel" />
    </transition-group>

  </div>
</template>

<script>
export default {
  data () {
    return {
      routerTransition: ''
    }
  },
  watch: {
    '$route' (to) {
      to.query && to.query.transitionName && (this.routerTransition = to.query.transitionName)
    }
  }
}
</script>



<style lang="stylus">
.router-enter
  opacity 0
.router-enter-active
  transition opacity 1.5s ease
.router-enter-to
  opacity 1

.router-leave
  opacity 1
.router-leave-active
  transition opacity 1.5s ease
.router-leave-to
  opacity 0


.router2-enter
  opacity 0
.router2-enter-active
  transition opacity 2s ease
.router2-enter-to
  opacity 1
  

.router2-leave
  opacity 1
.router2-leave-active
  transition opacity 2s ease
.router2-leave-to
  opacity 0

#app
  font-family 'Avenir', Helvetica, Arial, sans-serif
  -webkit-font-smoothing antialiased
  -moz-osx-font-smoothing grayscale
  text-align center
  color red

#nav
  padding 30px
  a
    font-weight bold
    &.router-link-exact-active
      color yellow
</style>
